package com.yq.myshixun.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

@Controller
public class MainController {
    @GetMapping({"/","login"})
    public String login(){
        return "login";
    }

    @GetMapping("/home")
    public String home(HttpSession session){
        if(session.getAttribute("curUser") == null)return "login";
        return "home";
    }

    @GetMapping("/logout")
    public String logout(HttpSession session){
        session.invalidate();
        return "login";
    }

}
